* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screen {
    display: none;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.screen.active {
    display: block;
}

/* 认证界面样式 */
.auth-container {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    text-align: center;
    max-width: 400px;
    margin: 0 auto;
}

.auth-container h1 {
    color: #333;
    margin-bottom: 30px;
    font-size: 2em;
}

.switch-auth {
    margin-top: 15px;
    color: #666;
}

.switch-auth a {
    color: #667eea;
    text-decoration: none;
}

.switch-auth a:hover {
    text-decoration: underline;
}

.admin-hint {
    margin-top: 20px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    font-size: 12px;
    color: #666;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#login-form input {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

#login-form input:focus {
    outline: none;
    border-color: #667eea;
}

#login-form button {
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

#login-form button:hover {
    background: #5a6fd8;
}

.hint {
    margin-top: 15px;
    color: #666;
    font-size: 14px;
}

/* 游戏菜单样式 */
.menu-container {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.user-actions {
    display: flex;
    gap: 10px;
}

.role-badge {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 8px;
}

.role-badge.admin {
    background: #dc3545;
}

.admin-btn {
    padding: 8px 16px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#logout-btn {
    padding: 8px 16px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.menu-container h2 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.game-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border: 2px solid #e9ecef;
    transition: transform 0.3s, border-color 0.3s;
}

.game-card:hover {
    transform: translateY(-5px);
    border-color: #667eea;
}

.game-card h3 {
    color: #333;
    margin-bottom: 10px;
}

.game-card p {
    color: #666;
    margin-bottom: 15px;
}

.game-card button {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.game-card button:hover {
    background: #5a6fd8;
}

/* 游戏界面样式 */
.game-container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.game-header h2 {
    color: #333;
}

.score {
    font-weight: bold;
    color: #667eea;
}

#back-to-menu {
    padding: 8px 16px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.game-area {
    display: flex;
    gap: 20px;
    justify-content: center;
}

#tetris-canvas {
    border: 2px solid #333;
    background: #000;
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 150px;
}

.next-piece {
    text-align: center;
}

.next-piece h4 {
    margin-bottom: 10px;
    color: #333;
}

#next-canvas {
    border: 1px solid #ccc;
    background: #000;
}

.controls {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
}

.controls h4 {
    margin-bottom: 10px;
    color: #333;
}

.controls p {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
}

.game-info button {
    padding: 10px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin: 5px 0;
}

.game-info button:hover {
    background: #218838;
}

#pause-game {
    background: #ffc107;
    color: #333;
}

#pause-game:hover {
    background: #e0a800;
}
/*
 管理员面板样式 */
.admin-container {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    max-width: 1000px;
    margin: 0 auto;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.admin-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.tab-btn.active {
    border-bottom-color: #667eea;
    color: #667eea;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.users-list {
    overflow-x: auto;
}

#users-table, #leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

#users-table th, #users-table td,
#leaderboard-table th, #leaderboard-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

#users-table th, #leaderboard-table th {
    background: #f8f9fa;
    font-weight: bold;
}

.status-active {
    color: #28a745;
    font-weight: bold;
}

.status-inactive {
    color: #dc3545;
    font-weight: bold;
}

.action-btn {
    padding: 4px 8px;
    margin: 0 2px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.toggle-btn {
    background: #ffc107;
    color: #333;
}

.delete-btn {
    background: #dc3545;
    color: white;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.stat-card h4 {
    margin-bottom: 10px;
    color: #666;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
}

.leaderboard {
    margin-top: 20px;
}

.game-stats {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.game-stats p {
    margin: 5px 0;
    color: #333;
}

/* 消息提示样式 */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 5px;
    color: white;
    font-weight: bold;
    z-index: 1000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.message.show {
    transform: translateX(0);
}

.message.success {
    background: #28a745;
}

.message.error {
    background: #dc3545;
}

.message.info {
    background: #17a2b8;
}